﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;

using mvcForum.Web.Controllers;
using mvcForum.Web.Interfaces;
using AddOnVM = mvcForum.Web.Areas.ForumAdmin.ViewModels.AddOn;
using mvcForum.Core.Interfaces.Data;

namespace mvcForum.Web.Areas.ForumAdmin.Controllers {

	public class AntiSpamController : ForumAdminBaseController {
		private readonly IEnumerable<IAntiSpamConfigurationController> controllers;

		public AntiSpamController(IWebUserProvider userProvider, IContext context, IEnumerable<IAntiSpamConfigurationController> controllers)
			: base(userProvider, context) {

			this.controllers = controllers;
		}

		public ActionResult Index() {
			return View(this.controllers.Select(c => new AddOnVM { Name = c.Name, Description = c.Description, ControllerName = c.GetType().Name.Substring(0, c.GetType().Name.Length - "Controller".Length) }));
		}
	}
}